package com.tcm.day06;

/**
 * 返回二叉树最大深度
 * https://leetcode.cn/problems/maximum-depth-of-binary-tree/description/?envType=problem-list-v2&envId=binary-tree
 */
public class Code04_TreeMaxDepth {

    public int maxDepth(TreeNode root) {

        if (null == root) {
            return 0;
        }

        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;

    }

}
